<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<meta http-equiv="keywords" content="" />
		<meta http-equiv="description" content="" />
		<title>見積検索</title>

		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<script src="assets/scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>

		<script src="assets/scripts/ui/jquery-ui-1.7.2.custom.js" type="text/javascript"></script>
		<link type="text/css" href="./assets/styles/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		<script type="text/javascript">
		$(function() {
		
			// メッセージのフェード
			$('.message').fadeIn("slow");

		});
		</script>
				
		<link rel="stylesheet" type="text/css" href="./assets/styles/tablesorter.css" />

		<script type="text/javascript" src="./assets/scripts/tablesorter.js"></script>
		<script type="text/javascript">
			var sorter = new TINY.table.sorter("sorter");
				sorter.head = "head";
				sorter.asc = "asc";
				sorter.desc = "desc";
				sorter.even = "evenrow";
				sorter.odd = "oddrow";
				sorter.evensel = "evenselected";
				sorter.oddsel = "oddselected";
				sorter.paginate = true;
				sorter.currentid = "currentpage";
				sorter.limitid = "pagelimit";
			$(function(){
					sorter.init("inquiry_result",0);
			});
		</script>
		<script type="text/javascript">

			//更新
			function updateAction(){
				var status5 = document.getElementById("status5").checked;
				var status6 = document.getElementById("status6").checked;
				if(status5){
					var value = document.getElementById("status5").value;
					if(confirm('更新してよろしいですか？')){
						document.fm1.mode.type="submit";
					}else{
						return false;
					}
				}				
				if(status6){
					var value = document.getElementById("status6").value;
					if(confirm('更新してよろしいですか？')){
						document.fm1.mode.type="submit";
					}else{
						return false;
					}
				}
				if(status5==false && status6==false){
					alert("承認ステータスを選択してください！");
				}				
			} 
			
			function checkform(){
				var flag = true;
				var n = 0;
				$("input[type=radio]").each(function(i){ 
					if(this.checked){
						n++;
					}
					/*
					if((i+1)%2==0){
						if(n==0){
							flag = false;
							return false;
						}
						n = 0;
					}
					*/
				}); 
				
				if(n == 0){
					flag = false;
					alert("NGまたはOKを選択してください");
				}
				return flag;
			}
		</script>
		
	</head>
	<body id="">
{{ php }} include( MENU_FILE ); {{ /php }}

		<div id="header" class="clearfix"><div class="wrapper">
			<h1><a href="./">コントロールパネル</a></h1>
			<form id="form_logout" action="logout.php" method="post"><p>{{ $login.staff_name }} <input type="submit" id="button_logout" value="ログアウト" /></p></form>
		</div></div>
		<div id="container"><div class="wrapper">

			<h2>見積管理</h2>
			<ul class="submenu clearfix">
				<li><a href="consumer_index.php">顧客検索</a></li>								
				<li><a href="consumer_form.php">顧客登録</a></li>
				<li>見積タスク一覧</li>
				<li><a href="price_check.php">見積検索</a></li>
				<li><a href="shop_index.php">商品マスタ</a></li>
			</ul>
			
			<h3>見積タスク一覧</h3>
			{{ if $phase == 'complete' }}
			<p class="message">更新が完了しました</p>
			<ul>
				<li>&gt;&gt; <a href="price_task.php">一覧へ戻る</a></li>
			</ul>
			{{ else }}
			<p class="message">見積タスクリスト</p>
			
			{{if $yes == 1}}
			<form name="fm1" action="price_task.php" method="post" onsubmit="return checkform()">
			<ul type="square" style="background-color: black;width: 10px;height: 10px;float: left;margin-top: 5px"></ul>
			<h5>承認待ちタスク一覧</h5>
			<table id="inquiry_result" class="formTable">
				<thead>					
					<tr align="center">
						<th>見積NO.</th>
						<th>作成日</th>
						<th>作成者</th>
						<th>会社名</th>
						<th>件名</th>
						<th>参照</th>
						<th style="width: 400px;">承認処理</th>						
					</tr>
	{{ foreach from=$pricelist key=k item=v }}
		{{if $v.status == 2}}
					<tr >
						<td align="center">{{ $v.price_no }}</td>
						<td align="center">{{ $v.m_date }}</td>
						<td align="center">{{ $v.producer }}</td>
						<td align="center">{{ $v.company_name }}</td>
						<td align="center"><img src="assets/images/titleicon/{{ $v.pro_name }}.gif"></img></td>
						<td align="center"><a href='make_price.php?price_no={{$v.price_no}}&consumer_id={{$v.consumer_id}}'>[参照]</a></td>
						<td style="width: 300px;">
							<input type="radio" name="status{{$v.price_no}}" value="3"  >OK</input>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;前回却下理由:{{ $v.status_reason }}<br/>
							<input type="radio" name="status{{$v.price_no}}" value="4" >NG</input>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							理由<input type="text" name="status_reason[]"  style="width: 200px;" />
						</td>
					</tr>
					<input type="hidden" name="price_no[]" value="{{ $v.price_no }}" />
		{{/if}}
	{{/foreach}}
				</thead>			
			</table>
			<p class="button">
				<input name="mode" value="update" type="hidden" />
				
				<button type="submit"  class="submit" style="float: right;" ><span>承認処理</span></button>
						
			</p>
			</form><br/><br/>
			{{/if}}	
	
			{{if $yes == 1 || $c>0 }}
			<ul type="square" style="background-color: black;width: 10px;height: 10px;float: left;margin-top: 5px"></ul>
			<h5>承認却下一覧</h5>
			<table class="formTable" >
				<thead>
					<tr align="center">
						<th>見積NO.</th>
						<th>作成日</th>
						<th>会社名</th>
						<th>件名</th>
						<th>却下日</th>
						<th>承認者</th>
						<th>更新</th>
						<th>承認却下理由</th>
					</tr>

				</thead>
				<tbody>
{{ foreach from=$pricelist key=k item=v }}
		{{if $v.status == 4 && $yes == 1 }}
					<tr align="center">
						<td>{{ $v.price_no }}</td>
						<td>{{ $v.m_date }}</td>
						<td>{{ $v.company_name }}</td>
						<td> <img src="assets/images/titleicon/{{ $v.pro_name }}.gif"></img> </td>
						<td>{{ $v.u_date }}</td>
						<td>{{ $staff[$v.examiner] }}</td>
						<td><a href='make_price.php?price_no={{$v.price_no}}&consumer_id={{$v.consumer_id}}'>[更新]</a></td>
						<td>{{ $v.status_reason }}</td>
					</tr>
		{{/if}}
		
		{{if $v.status == 4 && $yes == 0 && $v.staff_id==$mystaff_id}}
					<tr align="center">
						<td>{{ $v.price_no }}</td>
						<td>{{ $v.m_date }}</td>
						<td>{{ $v.company_name }}</td>
						<td> <img src="assets/images/titleicon/{{ $v.pro_name }}.gif"></img> </td>
						<td>{{ $v.u_date }}</td>
						<td>{{ $staff[$v.examiner] }}</td>
						<td><a href='make_price.php?price_no={{$v.price_no}}&consumer_id={{$v.consumer_id}}'>[更新]</a></td>
						<td>{{ $v.status_reason }}</td>
					</tr>
		{{/if}}
		
{{ /foreach }}
				</tbody>
			</table><br/><br/>
			{{/if}}	
			
			{{if $a>0 }}
			<div >
				<div >
				<ul type="square" style="background-color: black;width: 10px;height: 10px;float: left;margin-top: 5px"></ul>
					<h5>作成中一覧</h5>
					<table class="formTable" >
						<thead>
							<tr align="center">
								<th>見積NO.</th>
								<th>作成日</th>
								<th>会社名</th>
								<th>件名</th>
								<th>更新</th>
							</tr>
		
						</thead>
						<tbody>
		{{ foreach from=$pricelist key=k item=v }}
			{{if $v.status == 1 && $v.staff_id==$mystaff_id}}
							<tr align="center">
								<td>{{ $v.price_no }}</td>
								<td>{{ $v.m_date }}</td>
								<td>{{ $v.company_name }}</td>
								<td> <img src="assets/images/titleicon/{{ $v.pro_name }}.gif"></img> </td>
								<td align="center"><a href='make_price.php?price_no={{$v.price_no}}&consumer_id={{$v.consumer_id}}'>[更新]</a></td>
							</tr>
			{{/if}}
		{{ /foreach }}
						</tbody>
					</table>			
					</div>
					
					<div style="clear:both"></div>
					<br/><br/>
			{{/if}}		
			
			{{if $b>0 }}	
					<div >
					<ul type="square" style="background-color: black;width: 10px;height: 10px;float: left;margin-top: 5px"></ul>
					<h5>未処理一覧</h5>
					<table class="formTable" >
						<thead>
							<tr align="center">
								<th>見積NO.</th>
								<th>作成日</th>
								<th>会社名</th>
								<th>件名</th>
								<th>更新</th>
							</tr>
		
						</thead>
						<tbody>
		{{ foreach from=$pricelist key=k item=v }}
			{{if $v.status == 3 && $v.quoteprint == 0 && $v.staff_id==$mystaff_id}}
							<tr align="center">
								<td>{{ $v.price_no }}</td>
								<td>{{ $v.m_date }}</td>
								<td>{{ $v.company_name }}</td>
								<td><img src="assets/images/titleicon/{{ $v.pro_name }}.gif"></img></td>
								<td><a href='make_price.php?price_no={{$v.price_no}}&consumer_id={{$v.consumer_id}}'>[参照]</a></td>
							</tr>
			{{/if}}
		{{ /foreach }}
						</tbody>
						</table>
						</div>
					{{/if}}	
					</div>
			{{/if}}		
					<div style="clear: both;"></div>
		</div>
		</div>
		<address>Copyright (C) SHIFT Inc. / All rights reserved</address>

	</body>
</html>